<%@ page import="interview1.InterViewVo"%>
<%@ page import="interview1.InterView"%>
<%@ page import="java.util.Vector"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>interview_list.jsp</title>
<link rel='stylesheet' href="./interview/interview.css">
<style>
#bt_page{
width: 100%;
margin: 0 auto;
text-align: center;
}
#il_image{
margin-left: 78px;
}
</style>
<script>

function getId(id){ return document.getElementById(id);}

function btn_view(serial){
	location.href="index.jsp?inc_contents=./interview/interview_view.jsp&serial=" + serial;
}
function btn_insert1(){
	location.href="index.jsp?inc_contents=./jobtc.jsp";
}
function btn_insert2(){
	location.href="index.jsp?inc_contents=./interview/interview_upload.jsp";
}

function goPage(page){
	var ff = document.community_form;
	ff.nowPage.value = page;
	ff.action = "index.jsp?inc_contents=./interview_list.jsp";
	ff.submit();
}
</script>
</head>
<body>
<jsp:useBean id="interVo" class="interview1.InterViewVo"/>
<jsp:setProperty property="*" name="interVo"/>
<% 
//아이디 정보 가져오는 것(로그인 확인하는 것)
String sessionID=(String)session.getAttribute("mid");
%>
<div id="il_main">
	<br/>
	<div id="il_image"><img src="./image/company.jpg" width="810px"></div>
		<br/>
		<%
		InterView view = new InterView();
		view.setVo(interVo);
		view.setNowPage(interVo.getNowPage());
		
		Vector<InterViewVo> vo = view.list();
		InterViewVo vo2 = view.view();
		%>
		
		<div id="il_button">
			<!-- 검색 영역 -->
			<form name="community_form" method="post" action="index.jsp?inc_contents=./interview_list.jsp">
				<!-- 뷰에 들어가기 전에 쳤던 검색어를 유지하기 위해서 value 값에다가 getFind() 한다 -->
				<input type="text" name="find" id="find" value="<%=interVo.getFind()%>"> 
				<input type="submit" value="검색" id="btnFind_il">
				<input type="hidden" name="nowPage" value="<%=view.getNowPage()%>">
			</form>
			<p/>
		</div>
		<div id="il_button2">
		
		<%if(sessionID != null){ %>
		<input type="button" id="il_button_bt" value="게시글 작성" onclick="btn_insert2()">&nbsp;
		<%} %>
		<input type="button" id="il_button_bt" value="취업센터" onclick="btn_insert1()">
		</div><br/>
		<div style="width: 100%; height: 30px;"></div>
		
		
			<%
			if(vo.size() == 0){
				%>
				<center><img src="./image/no_find.png"><br/>
				<%
				out.print("검색결과가 없습니다.");
				%>
				</center>
				<%
			}else{%>
			
			<div id="interview_title">
				<div id="inter_title_serial">번호</div>
				<div id="inter_title_mid">아이디</div>
				<div id="inter_title_subject">제목</div>
				<div id="inter_title_mdate">등록일</div>
			<%
			for (int i=0; i<vo.size(); i++){
				InterViewVo vo1 = vo.get(i);
				%>
				<div id="li_serial"><%=vo1.getSerial()%></div>
				<div id="li_mid"><%=vo1.getMid()%></div>
				<div id="li_subject"><a href="#" onclick="btn_view(<%=vo1.getSerial()%>)"><%=vo1.getSubject()%></a></div>
				<div id="li_mdate"><%=vo1.getMdate()%></div>
				<%}%>
		</div>
		<div style="width: 100%;height: 5px; display: inline-block;"></div>
	<br/><br/>
		<!-- 페이지 분리 영역 -->
		<div id="bt_page">
			<%if(view.getNowBlock()>1) {%>
			<input type="button" class="il_btt2" onclick="goPage(1)" value=" " style="background-image: url(./image/b1.jpg);">
			<input type="button" class="il_btt2" onclick="goPage(<%=view.getStartPage() -1%>)" value=" " style="background-image: url(./image/b2.jpg);">
			<% }%>
			&emsp;
			<%for(int p =view.getStartPage(); p<=view.getEndPage(); p++) {%>
			<input type="button" class="il_btt" onclick="goPage(<%=p%>)" value="<%=p%>">
			<%} %>
			&emsp;
			<%if(view.getNowBlock() < view.getTotBlock()){ %>
			<input type="button" class="il_btt2" onclick="goPage(<%=view.getEndPage() + 1%>)" value=" " style="background-image: url(./image/a1.jpg);">
			<input type="button" class="il_btt2" onclick="goPage(<%=view.getTotPage()%>)" value=" " style="background-image: url(./image/a2.jpg);">
			<%} %>
		</div>
		<%}%>
	
	<div style="width: 100%;height: 50px; display: inline-block;"></div>
</div>
<script>
init();
</script>
</body>
</html>